using System;
using System.Collections.Generic;
using System.Text;
using System.Configuration;
using Entities;
using DAL;
using System.Data.SqlClient;
using System.Data;

namespace BUS
{
    public class tbTrangThai_GiaoDichBUS
    {
        public static void Insert(tbTrangThai_GiaoDichEntities TTGD)
        {
            tbTrangThai_GiaoDichDAL TTGDDAL = new tbTrangThai_GiaoDichDAL();
            TTGDDAL.Insert(TTGD);
        }

        public static void Update(tbTrangThai_GiaoDichEntities TTGD)
        {
            tbTrangThai_GiaoDichDAL TTGDDAL = new tbTrangThai_GiaoDichDAL();
            TTGDDAL.Insert(TTGD);
        }

        public static void Delete(int iD)
        {
            tbTrangThai_GiaoDichDAL TTGDDAL = new tbTrangThai_GiaoDichDAL();
            TTGDDAL.Delete(iD);
        }

        public static Entities.tbTrangThai_GiaoDichEntities.tbTrangThai_GiaoDichColection Get(string where, int pageindex, int pagesize, string orderby, string orderdirection, out int total)
        {
            tbTrangThai_GiaoDichDAL TTGDDAL = new tbTrangThai_GiaoDichDAL();
            return TTGDDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }

        public static Entities.tbTrangThai_GiaoDichEntities.tbTrangThai_GiaoDichColection GetAll()
        {
            int total = 0;
            tbTrangThai_GiaoDichDAL TTGDDAL = new tbTrangThai_GiaoDichDAL();
            return TTGDDAL.Get("where 1=1", 0, 0, Entities.tbTrangThai_GiaoDichEntities.tbTrangThai_GiaoDichColumn.MaTT.ToString(), "ASC", out total);
        }

        public static tbTrangThai_GiaoDichEntities GetByID(int iD)
        {
            int total = 0;
            tbTrangThai_GiaoDichDAL TTGDDAL = new tbTrangThai_GiaoDichDAL();
            Entities.tbTrangThai_GiaoDichEntities.tbTrangThai_GiaoDichColection TTGDCollection = TTGDDAL.Get("where " + Entities.tbTrangThai_GiaoDichEntities.tbTrangThai_GiaoDichColumn.MaTT.ToString() + "=" + iD.ToString(), 0, 0, Entities.tbTrangThai_GiaoDichEntities.tbTrangThai_GiaoDichColumn.MaTT.ToString(), "ASC", out total);
            if (TTGDCollection.Count > 0)
                return TTGDCollection[0];
            return null;
        }
    }
}
